<?php
/**
 * User: fu
 * Date: 12-4-12
 * Time: 下午3:11
 */

date_default_timezone_set('Asia/Shanghai');

set_include_path('.' . PATH_SEPARATOR . './lib' . PATH_SEPARATOR .'./app/model'. PATH_SEPARATOR . get_include_path());

require_once('Zend/Loader/Autoloader.php');
Zend_Loader_Autoloader::getInstance()->setFallbackAutoloader(true);

$registry = Zend_Registry::getInstance();
$view = new Zend_View();
$view->setScriptPath('./app/view/scripts/');
$registry['view']=$view;


//配置数据库参数,并连接数据库
$config=new Zend_Config_Ini('./app/config/config.ini',null, true);
Zend_Registry::set('config',$config);
$dbAdapter=Zend_Db::factory($config->general->db->adapter,$config->general->db->config->toArray());
$dbAdapter->query('SET NAMES UTF8');
Zend_Db_Table::setDefaultAdapter($dbAdapter);
Zend_Registry::set('dbAdapter',$dbAdapter);


$frontControl = Zend_Controller_Front::getInstance();
$frontControl->setBaseUrl('/zend')
             ->setParam('noViewRenderer',true)
             ->setControllerDirectory('./app/control')
             ->throwExceptions(true)
             ->dispatch();
